Webhook – it is a mechanism for notifying a third-party system about events that have occurred in the VIEWAPP. Third-party system in this case & ndash; your server or a service configured to receive notifications
When one of the ticked events occurs, our server will send a request to the address specified in the url. The request is sent using the POST
method. In the request header Content-Type: application/json
. In the body of the json request with data. The content depends on the event.
If a 50X code is received in response to a request or it is impossible to establish a connection with the receiving server due to a network error (connection timeout, DNS errors, etc.), then the request will be sent again. Retry attempts – 5 pieces at intervals of [2, 10, 60, 300] seconds. In the json package, the attempt
field will indicate which attempt is in total, but only for (attempt >= 2). The auto-retry mechanism works for all webhooks, and is needed in case the receiving server is temporarily unavailable.
Save the webhook so that you can send a test request to the specified url. If several events are marked, then the test request will contain data that matches one of the selected events
Create a new WebHook
After clicking the add button, a Webhook creation form opens.
Peculiarities |
When creating an inspection (when the inspection is first recorded in the server database) |
Coverage |
The role of the owner of the webhook is taken into account (who created, that and the owner). Administrators are notified of all new company scans. Group Administrators – inspections of those access groups to which the group administrator belongs. |
Peculiarities |
At the time of creating an inspection in the database, no data is tied to it, except for the key determinants, such as: who created it, according to what template, for which company. For post-processing via the integration api, it is more convenient to use the "Inspection changed status" event. |
Sample request content:
{
"event": "inspection_created",
"model": "Inspection",
"id": 2442,
"data": {
"created_by": {
"id": 742,
"email": "operator@the.best",
"phone": "+74440001122",
"first_name": "Оператор",
"middle_name": "Операторовна",
"last_name": "Телефонова",
"role": "callcenter"
},
"status": "draft",
"object_name": "Авто для осмотра",
"service_name": "500 AUTO",
"is_web_created": true
}
}
Works |
When the inspection was shared with another user via a mobile app, admin interface, or via the integration api. |
Coverage |
The role of the owner of the webhook is taken into account (who created, that and the owner). Administrators are sent messages about all company inspections. Group Administrators – information about inspections of those access groups to which the group administrator belongs. |
Peculiarities |
The person who shares the inspection indicates the recipient's full name and phone number. The system finds the recipient in the database, or creates a new user with the "client" role. In the notification data, we send information about both the recipient and who shared the inspection. |
Sample request content:
{
"event": "inspection_shared",
"model": "Inspection",
"id": 2442,
"data": {
"created_by": {
"id": 742,
"email": "operator@the.best",
"phone": "+74440001122",
"first_name": "Оператор",
"middle_name": "Операторовна",
"last_name": "Телефонова",
"role": "callcenter"
},
"status": "repeat",
"object_name": "Авто для осмотра",
"service_name": "500 AUTO",
"is_web_created": true,
"shared_by": {
"id": 1042,
"email": "old@client.xx",
"phone": "+79990008855",
"first_name": "Семён",
"middle_name": "Петрович",
"last_name": "Поливайко",
"role": "client"
},
"shared_for": {
"id": 12042,
"email": "new@client.xx",
"phone": "+70001112233",
"first_name": "Ирина",
"middle_name": "Игоревна",
"last_name": "Поливайко",
"role": "client"
}
}
}
Works |
When the server receives the first request to initialize a new shooting for inspection |
Coverage |
The role of the owner of the webhook is taken into account (who created, that and the owner). Administrators are sent messages about all company inspections. Group Administrators – notification about inspections from those access groups to which the group administrator belongs. |
Peculiarities |
We fix the moment when the user first came to photographing. This event can be considered the actual start of the inspection, since filling out the inspection form quite often does not mean that the user is going to photograph something. Keep in mind that the notification comes at the moment when the server receives data about the start of the shooting, and not at the moment of the start of the shooting as such. The user can be offline at this time. |
Sample request content:
{
"event": "inspection_first_process",
"model": "Inspection",
"id": 5642,
"data": {
"created_by": {
"id": 4242,
"email": "foo@email.xx",
"phone": "+70010023456",
"first_name": "Константин",
"middle_name": "Константинович",
"last_name": "Константинопольский",
"role": "client"
},
"status": "draft",
"object_name": "Автодляосмотра",
"service_name": "500 AUTO",
"is_web_created": false
}
}
Works |
After installation, the new status will be examined (when the status is changed in the server database) |
Coverage |
The role of the owner of the webhook is taken into account (who created, that and the owner). Administrators are sent messages about all company inspections. Group Administrators – Changes to the statuses of inspections of those access groups to which the group administrator belongs. |
Peculiarities |
The notification uses status aliases, rather than their textual representation for users. Below are the statuses with their basic texts (personal texts can be set for assemblies – they are not taken into account here). The list can be expanded at a later time, do not lim it the variance on the receiving side to what is listed here.
|
More info about statuses at Status model
Sample request content:
{
"event": "inspection_status_changed",
"model": "Inspection",
"id": 2442,
"data": {
"created_by": {
"id": 742,
"email": "operator@the.best",
"phone": "+74440001122",
"first_name": "Оператор",
"middle_name": "Операторовна",
"last_name": "Телефонова",
"role": "callcenter"
},
"status": "expertise",
"object_name": "Авто для осмотра",
"service_name": "500 AUTO",
"is_web_created": true
}
}
Works |
When a request comes to the server, generated by clicking on the "Submit for verification" button |
Coverage |
The role of the owner of the webhook is taken into account (who created, that and the owner). Administrators are sent messages about all company inspections. Group Administrators – notification about inspections from those access groups to which the group administrator belongs. |
Peculiarities |
The system separately records the fact of pressing the "Submit for verification" button. In order for the action to be performed, several criteria must be met, including the completeness of the inspection template. The request "send for verification" comes to the server, as a rule, before the files arrive. However, it is not guaranteed that webhooks will first receive a notification "inspection sent for verification", and only after that a notification about the status change for expertise. Do not build on your side the logic of work, assuming a strict sequence of alerts. She is not strict! |
Sample request content:
{
"event": "inspection_ended_by_user",
"model": "Inspection",
"id": 2442,
"data": {
"created_by": {
"id": 742,
"email": "operator@the.best",
"phone": "+74440001122",
"first_name": "Оператор",
"middle_name": "Операторовна",
"last_name": "Телефонова",
"role": "callcenter"
},
"ended_by": {
"id": 4242,
"email": "foo@email.xx",
"phone": "+70010023456",
"first_name": "Константин",
"middle_name": "Константинович",
"last_name": "Константинопольский",
"role": "client"
},
"status": "draft",
"object_name": "Авто для осмотра",
"service_name": "500 AUTO",
"is_web_created": true
}
}
Works |
When an inspection is submitted for approval (usually, during a review when a change is made by an expert) |
Coverage |
The role of the owner of the webhook is taken into account (who created, that and the owner). Administrators are sent messages about all company inspections. Group Administrators – notification about inspections from those access groups to which the group administrator belongs. |
Sample request content:
{
"event": "inspection_approval",
"occurred_at": "2022-03-15 04:17:31",
"model": "Inspection",
"id": 2442,
"data": {
"created_by": {
"id": 742,
"email": "operator@the.best",
"phone": "+74440001122",
"first_name": "Operator",
"middle_name": "Operatorovna",
"last_name": "Telefonova",
"role": "callcenter"
},
"status": "approval",
"object_name": "Auto for inspection",
"service_name": "500 AUTO",
"service_uuid": "6c8e1120-b955-11e9-8e50-279abb86ccf7",
"is_web_created": true,
"created_via": {
"interface": "integrapi",
"channel": "clone"
}
}
}
Works |
At the moment when the inspection is transferred on the server side to the Expertise status |
Coverage |
The role of the owner of the webhook is taken into account (who created, that and the owner). Administrators are sent messages about all company inspections. Group Administrators – notification about inspections from those access groups to which the group administrator belongs. |
Peculiarities |
The expertise status is set by the examination by the server when the following criteria are met simultaneously:
Warning! Inspection can be forced to check through the administrative interface or the integration api even if the above criteria are not met. |
Sample request content:
{
"event": "inspection_status_changed_to_expertise",
"model": "Inspection",
"id": 5642,
"data": {
"created_by": {
"id": 4242,
"email": "foo@email.xx",
"phone": "+70010023456",
"first_name": "Константин",
"middle_name": "Константинович",
"last_name": "Константинопольский",
"role": "client"
},
"status": "expertise",
"object_name": "Авто для осмотра",
"service_name": "500 AUTO",
"is_web_created": false
}
}
Works |
When a new user signs up on their own in the mobile application. The notification is sent after the user confirms his phone number or after the user activates, if registration is carried out without confirming the phone number. |
Coverage |
The role of the owner of the webhook is taken into account (who created, that and the owner). Administrators are sent messages about all new users associated with the administrator's company. Group Administrators – information about new users who, upon registration, are automatically associated with access groups to which the group administrator himself belongs. |
Sample request content:
{
"event": "user_self_registered",
"model": "User",
"id": 4242,
"data": {
"email": "foo@email.xx",
"phone": "+70010023456",
"first_name": "Константин",
"middle_name": "Константинович",
"last_name": "Константинопольский",
"role": "client"
}
}
Works |
When a new user is added to the system, but not as a result of self-registration through the application (there is a separate event for this), but when a user was added through one of the auxiliary interfaces:
|
Coverage |
The role of the owner of the webhook is taken into account (who created, that and the owner). Administrators are sent messages about all new users associated with the administrator's company. Group Administrators – information about new users who, when created, were bound to access groups to which the group administrator himself belongs. |
Peculiarities |
The user could be added programmatically (via integrapi) without binding to access groups, then this binding can be set by a separate request. In this case, the group administrator will not receive a notification, but the administrator will receive it. |
Sample request content:
{
"event": "user_added",
"model": "User",
"id": 4242,
"data": {
"email": "foo@email.xx",
"phone": "+70010023456",
"first_name": "Константин",
"middle_name": "Константинович",
"last_name": "Константинопольский",
"role": "client",
"created_by": {
"id": 742,
"email": "boo@email.xx",
"phone": "+70010023789",
"first_name": "Александр",
"middle_name": "Александрович",
"last_name": "Александров",
"role": "admin"
},
"interface": "web"
}
}
Works |
After the user sends a request to technical support from the mobile application. |
Coverage |
The role of the owner of the webhook is taken into account (who created, that and the owner). Administrators are sent messages from users associated with the administrator's company. Group Administrators – messages from users who are bound to the same access groups as the group administrator himself (to at least one of the groups). |
Peculiarities |
So far, very little information is known when contacting support. In fact, when processing such requests, you should rely on the text of the message and who sent it. |
Sample request content:
{
"event": "support_mob_issue_created",
"model": "FeedbackLog",
"id": 7,
"data": {
"text": "Я что-то нажала, и у меня всё сломалось!",
"created_by": {
"id": 742,
"email": "dumby@email.xx",
"phone": "+70010023700",
"first_name": "Александра",
"middle_name": "Александровна",
"last_name": "Александрова",
"role": "client"
}
}
}
Works |
When the next GPS point comes to the server from the mobile application AND, the inspection has already been transferred to the expertise or transferred to one of the final statuses |
Coverage |
The role of the owner of the webhook is taken into account (who created, that and the owner). Administrators are sent messages about all company inspections. Group Administrators – notification about scans from those access groups to which the group administrator belongs. |
Peculiarities |
Inspection data comes to the server in order: first general metadata, then files, and last of all information from sensors and GPS coordinates. It is assumed that at the time of the transition of the inspection to the expertise status, the GPS coordinates from the application have not yet arrived at the server. You can subscribe to an event in order to receive all received GPS coordinates after the transition from inspection to expertise. A webhook will be called for each arriving point. Including duplicate coordinates. If the inspection is switched to repeat, the webhook will not be called. |
Sample request content:
{
"event": "inspection_gps_received",
"occurred_at": "2021-11-16 16:15:01",
"model": "Inspection",
"id": 2442,
"data": {
"created_by": {
"id": 742,
"email": "operator@the.best",
"phone": "+74440001122",
"first_name": "Оператор",
"middle_name": "Операторовна",
"last_name": "Телефонова",
"role": "callcenter"
},
"status": "expertise",
"object_name": "Авто для осмотра",
"service_name": "500 AUTO",
"service_uuid": "6c8e1120-b955-11e9-8e50-279abb86ccf7",
"is_web_created": true,
"lat": 48.208477999999999,
"lon": 16.373197999999999,
"gps_source": "admin"
}
}
Works |
When changing the inspection template or when creating a new inspection template |
Coverage |
The current access of the user on whose behalf the webhook was added to the system is taken into account. The data is sent provided that the user has access to the inspection template. |
Peculiarities |
The event fires both when changes are made and when a new inspection template is created, if it is immediately known that the user who created the webhook has access rights to the inspection template. Changes that increase the version of the inspection template are guaranteed to be logged. For example, editing steps or deleting steps. Not guaranteed, but a webhook can be sent on other inspection template edit events as well. Non-guaranteed changes are considered not critical to the inspection process. For major changes, the inspection template is always upgraded. |
Sample request content:
{
"event": "insure_service_changed",
"occurred_at": "2021-11-16 16:15:01",
"model": "InsureService",
"uuid": "acecbb50-b948-11e9-9aee-41e83687f92c",
"data": {
"name": "Общий осмотр объекта силами клиента"
}
}